

#ifndef _SPRING_H

#define _SPRING_H

#include "Elemento_Fisico.h"
#include "NodoFisico.h"
#include "Vector.h"
#include "Algebra.h"
#include <math.h>
#include <iostream>

using namespace::std;

class Spring : public Elemento_Fisico
{
public:
	//Constructor
	Spring();

	//Propiedades
	void setConstStiffness(const double &K){dblConstantK = K;}
	double getConstStiffness(){return dblConstantK;}

	void setNodo1(const NodoFisico &Nodo1){objNodo1 = Nodo1;}
	NodoFisico& getNodo1(){return objNodo1;}

	void setNodo2(const NodoFisico &Nodo2){objNodo2 = Nodo2;}
	NodoFisico& getNodo2(){return objNodo2;}

	void setIndice1(const unsigned int &I1){intIndice1 = I1;}
	unsigned int getIndice1(){return intIndice1;}

	void setIndice2(const unsigned int &I2){intIndice2 = I2;}
	unsigned int getIndice2(){return intIndice2;}

	void setNodoCalculado(const unsigned int &nCalculado){intNodoCalculado = nCalculado;}
	unsigned int getNodoCalculado(){return intNodoCalculado;}

	Vector& getFuerzaInterna(){return vfuerzaInterna;}

	//Metodos
	void CalcularRestLong();
	void CalcularFuerzaInterna();

private:
	//Atributos
	double dblConstantK;
	double dblLongRest;
	double dblLongActual;
	NodoFisico objNodo1;
	NodoFisico objNodo2;
	unsigned int intIndice1;
	unsigned int intIndice2;
	unsigned int intNodoCalculado;

	Vector vDirNodo12;
	Vector vDirNodo21;
	Vector vfuerzaInterna;

	double CalcularLongNodos();
	void CalcularActualLong();
};

#endif

